{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "78e14a52",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_conn():\n",
    "    \"\"\"\n",
    "    :return: 连接, 游标\n",
    "    \"\"\"\n",
    "    # 创建连接\n",
    "    conn = pymysql.connect(host=\"127.0.0.1\",\n",
    "                          user=\"root\",\n",
    "                          password=\"123456\",\n",
    "                          db=\"covid_2019\",\n",
    "                          charset=\"utf-8\")\n",
    "    # 创建游标\n",
    "    cursor = conn.cursor()\n",
    "    \n",
    "    return conn, cursor\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f44e554d",
   "metadata": {},
   "outputs": [],
   "source": [
    "def close_conn(conn, cursor):\n",
    "    if cursor:\n",
    "        cursor.close()\n",
    "    if conn:\n",
    "        conn.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8446dfb4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import traceback\n",
    "\n",
    "def update_details():\n",
    "    \"\"\"\n",
    "    更新 deatails 表\n",
    "    :return:\n",
    "    \"\"\"\n",
    "    \n",
    "    cursor = None\n",
    "    conn = None\n",
    "    \n",
    "    try:\n",
    "        li = get_tencent_data()[1]  # 0 是历史数据字典, 1 最新详细数据列表\n",
    "        conn, cursor = get_conn()\n",
    "        \n",
    "        sql = \"insert into details(update_time, province, city, confirm, confirm_add, heal, dead) values(%s, %s, %s, %s, %s, %s, %s)\"\n",
    "        sql_query = 'select %s=(select update_time from details order by id desc limit 1)'  # 对比当前最大时间戳 当前数据时间和最大时间相等返回 1 不等返回 0\n",
    "        \n",
    "        cursor.execute(sql_query, li[0][0])  # 随便取一个元素的时间\n",
    "        \n",
    "        if not cursor.fetchone()[0]:\n",
    "            print(f\"{time.asctime()}开始更新最新数据 !\")\n",
    "            for item in  li:\n",
    "                cursor.execute(sql, item)\n",
    "            \n",
    "            conn.commit()  # 提交事务 update delete insert 操作\n",
    "            \n",
    "            print(f\"{time.asctime()}更新最新数据完毕 !\")\n",
    "        else:\n",
    "            print(f\"{time.asctime()}已是最新数据 !\")\n",
    "            \n",
    "    except:\n",
    "        traceback.print_exc()  # 打印异常信息\n",
    "    finally:\n",
    "        close_conn(conn, cursor)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c34ceef7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# history\n",
    "+-------------+--------------------+-----------+\n",
    "| column_name | column_comment     | data_type |\n",
    "+-------------+--------------------+-----------+\n",
    "| ds          | 日期               | datetime  |\n",
    "| confirm     | 累计确诊           | int       |\n",
    "| confirm_add | 当日新增确诊       | int       |\n",
    "| suspect     | 剩余疑似           | int       |\n",
    "| suspect_add | 当日新增疑似       | int       |\n",
    "| heal        | 累计治愈           | int       |\n",
    "| heal_add    | 当日新增治愈       | int       |\n",
    "| dead        | 累计死亡           | int       |\n",
    "| dead_add    | 当日新增死亡       | int       |\n",
    "+-------------+--------------------+-----------+"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3e39767e",
   "metadata": {},
   "outputs": [],
   "source": [
    "def insert_history():\n",
    "    \"\"\"\n",
    "    插入历史数据, 第一次运行项目直接插入\n",
    "    :return:\n",
    "    \"\"\"\n",
    "    \n",
    "    cursor = None\n",
    "    conn = None\n",
    "    \n",
    "    try:\n",
    "        dic = get_tecent_data()[0]  # 0 是历史数据字典, 1 最新详细数据列表\n",
    "        print(f\"{time.asctime()}开始插入历史数据 !\")\n",
    "        \n",
    "        conn, cursor = get_conn()\n",
    "\n",
    "        sql = \"insert into history values(%s,%s,%s,%s,%s,%s,%s,%s,%s)\"\n",
    "        for k, v in dic.items():\n",
    "            # item 格式 {'2020-01-03': {'confirm': 0, 'suspect': 0, 'heal': 0, 'dead': 0}}\n",
    "            cursor.execute(sql,\n",
    "                          [k, v.get(\"confirm\"), v.get(\"confirm_add\"), v.get(\"suspect_add\")   # v.get() 有返回值 无返回 None\n",
    "                           v.get(\"suspect_add\"), v.get(\"heal\"), v.get(\"heal_add\")\n",
    "                          , v.get(\"dead\"), v.get(\"dead_add\")]\n",
    "                          )\n",
    "        \n",
    "        conn.commit()\n",
    "        print(f\"{time.asctime()}插入数据完毕 ！\")\n",
    "    except:\n",
    "        traceback.print_exc()\n",
    "    finally:\n",
    "        close_conn(con, cursor)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "97cc30ab",
   "metadata": {},
   "outputs": [],
   "source": [
    "# def update_history():\n",
    "#     \"\"\"\n",
    "#     更新历史数据\n",
    "#     :return:\n",
    "#     \"\"\"\n",
    "    \n",
    "#     cursor = None\n",
    "#     conn = None\n",
    "    \n",
    "#     try:\n",
    "#         dic = get_tecent_data()[0]  # 0 是历史数据字典, 1 最新详细数据列表\n",
    "#         print(f\"{time.asctime()}开始更新历史数据 !\")\n",
    "        \n",
    "#         conn, cursor = get_conn()\n",
    "\n",
    "#         sql = \"insert into history values(%s,%s,%s,%s,%s,%s,%s,%s,%s)\"\n",
    "#         sql_qurey = \"select confirm from history where ds=%s\"\n",
    "        \n",
    "#         for k, v in dic.items():\n",
    "#             # item 格式 {'2020-01-03': {'confirm': 0, 'suspect': 0, 'heal': 0, 'dead': 0}}\n",
    "            \n",
    "#             if not currsor.execute(sql_query, k):\n",
    "#                 cursor.execute(sql,\n",
    "#                           [k, v.get(\"confirm\"), v.get(\"confirm_add\"),, v.get(\"suspect_add\")   # v.get() 有返回值 无返回None\n",
    "#                            v.get(\"suspect_add\"), v.get(\"heal\"), v.get(\"heal_add\")\n",
    "#                           , v.get(\"dead\"), v.get(\"dead_add\")]\n",
    "#                           )\n",
    "        \n",
    "#         conn.commit()\n",
    "#         print(f\"{time.asctime()}历史数据更新完毕 ！\")\n",
    "#     except:\n",
    "#         traceback.print_exc()\n",
    "#     finally:\n",
    "#         close_conn(con, cursor)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "902dfbc1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[['2021-10-11 11:03:21', '台湾', '地区待确认', 16294, 7, 7, 846], ['2021-10-11 11:03:21', '云南', '境外输入', 1124, 14, 14, 0], ['2021-10-11 11:03:21', '云南', '德宏州', 225, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '昭通市', 25, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '曲靖', 13, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '昆明', 53, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '保山市', 9, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '玉溪', 14, 0, 0, 1], ['2021-10-11 11:03:21', '云南', '红河', 9, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '丽江市', 7, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '大理', 13, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '西双版纳州', 15, 0, 0, 1], ['2021-10-11 11:03:21', '云南', '文山州', 2, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '普洱', 4, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '楚雄州', 4, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '临沧', 1, 0, 0, 0], ['2021-10-11 11:03:21', '云南', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '厦门', 275, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '莆田', 261, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '境外输入', 524, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '泉州', 71, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '漳州', 23, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '三明', 14, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '宁德', 26, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '龙岩', 6, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '南平', 20, 0, 0, 0], ['2021-10-11 11:03:21', '福建', '福州', 72, 0, 0, 1], ['2021-10-11 11:03:21', '福建', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '香港', '地区待确认', 12261, 0, 0, 213], ['2021-10-11 11:03:21', '上海', '境外输入', 2274, 3, 3, 0], ['2021-10-11 11:03:21', '上海', '徐汇', 18, 0, 0, 1], ['2021-10-11 11:03:21', '上海', '浦东', 77, 0, 0, 1], ['2021-10-11 11:03:21', '上海', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '宝山', 26, 0, 0, 1], ['2021-10-11 11:03:21', '上海', '黄浦', 22, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '长宁', 14, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '境外来沪', 1, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '外地来沪', 113, 0, 0, 1], ['2021-10-11 11:03:21', '上海', '嘉定', 9, 0, 0, 2], ['2021-10-11 11:03:21', '上海', '松江', 16, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '静安', 16, 0, 0, 1], ['2021-10-11 11:03:21', '上海', '青浦', 6, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '崇明', 4, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '金山', 4, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '虹口', 7, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '奉贤', 9, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '杨浦', 9, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '普陀', 11, 0, 0, 0], ['2021-10-11 11:03:21', '上海', '闵行', 19, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '哈尔滨', 498, 0, 0, 4], ['2021-10-11 11:03:21', '黑龙江', '境外输入', 402, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '绥化', 537, 0, 0, 4], ['2021-10-11 11:03:21', '黑龙江', '地区待确认', 2, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '齐齐哈尔', 44, 0, 0, 1], ['2021-10-11 11:03:21', '黑龙江', '大庆', 29, 0, 0, 1], ['2021-10-11 11:03:21', '黑龙江', '黑河', 24, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '牡丹江', 36, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '大兴安岭', 3, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '双鸭山', 52, 0, 0, 3], ['2021-10-11 11:03:21', '黑龙江', '鹤岗', 5, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '七台河', 17, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '鸡西', 46, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '伊春', 1, 0, 0, 0], ['2021-10-11 11:03:21', '黑龙江', '佳木斯', 15, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '境外输入', 233, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '金华', 55, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '省十里丰监狱', 36, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '丽水', 17, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '舟山', 10, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '衢州', 14, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '台州', 147, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '绍兴', 42, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '嘉兴', 46, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '湖州', 10, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '温州', 504, 0, 0, 1], ['2021-10-11 11:03:21', '浙江', '宁波', 157, 0, 0, 0], ['2021-10-11 11:03:21', '浙江', '杭州', 181, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '境外输入', 1628, 2, 2, 0], ['2021-10-11 11:03:21', '广东', '中山', 68, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '汕头', 25, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '东莞', 102, 0, 0, 1], ['2021-10-11 11:03:21', '广东', '深圳', 431, 0, 0, 3], ['2021-10-11 11:03:21', '广东', '佛山', 101, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '广州', 523, 0, 0, 1], ['2021-10-11 11:03:21', '广东', '湛江', 23, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '汕尾', 6, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '河源', 5, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '珠海', 98, 0, 0, 1], ['2021-10-11 11:03:21', '广东', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '揭阳', 10, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '江门', 23, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '梅州', 16, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '肇庆', 19, 0, 0, 1], ['2021-10-11 11:03:21', '广东', '阳江', 14, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '惠州', 62, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '茂名', 14, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '韶关', 10, 0, 0, 1], ['2021-10-11 11:03:21', '广东', '清远', 12, 0, 0, 0], ['2021-10-11 11:03:21', '广东', '潮州', 5, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '境外输入', 165, 4, 4, 0], ['2021-10-11 11:03:21', '山东', '淄博', 30, 0, 0, 1], ['2021-10-11 11:03:21', '山东', '青岛', 80, 0, 0, 1], ['2021-10-11 11:03:21', '山东', '济宁', 260, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '济南', 47, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '泰安', 35, 0, 0, 2], ['2021-10-11 11:03:21', '山东', '潍坊', 44, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '枣庄', 24, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '烟台', 58, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '威海', 38, 0, 0, 1], ['2021-10-11 11:03:21', '山东', '菏泽', 18, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '滨州', 15, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '聊城', 38, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '德州', 37, 0, 0, 2], ['2021-10-11 11:03:21', '山东', '临沂', 49, 0, 0, 0], ['2021-10-11 11:03:21', '山东', '日照', 16, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '境外输入', 53, 1, 1, 0], ['2021-10-11 11:03:21', '广西', '桂林', 32, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '北海', 44, 0, 0, 1], ['2021-10-11 11:03:21', '广西', '防城港', 19, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '来宾', 11, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '柳州', 24, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '河池', 28, 0, 0, 1], ['2021-10-11 11:03:21', '广西', '南宁', 56, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '玉林', 11, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '钦州', 8, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '贵港', 8, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '梧州', 5, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '百色', 3, 0, 0, 0], ['2021-10-11 11:03:21', '广西', '贺州', 4, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '境外输入', 104, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '开封', 33, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '郑州', 295, 0, 0, 5], ['2021-10-11 11:03:21', '河南', '商丘', 107, 0, 0, 3], ['2021-10-11 11:03:21', '河南', '驻马店', 143, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '许昌', 40, 0, 0, 1], ['2021-10-11 11:03:21', '河南', '安阳', 54, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '南阳', 156, 0, 0, 3], ['2021-10-11 11:03:21', '河南', '漯河', 36, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '周口', 76, 0, 0, 1], ['2021-10-11 11:03:21', '河南', '鹤壁', 19, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '信阳', 274, 0, 0, 2], ['2021-10-11 11:03:21', '河南', '济源示范区', 5, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '新乡', 57, 0, 0, 3], ['2021-10-11 11:03:21', '河南', '焦作', 32, 0, 0, 1], ['2021-10-11 11:03:21', '河南', '平顶山', 58, 0, 0, 1], ['2021-10-11 11:03:21', '河南', '洛阳', 31, 0, 0, 1], ['2021-10-11 11:03:21', '河南', '濮阳', 17, 0, 0, 0], ['2021-10-11 11:03:21', '河南', '三门峡', 7, 0, 0, 1], ['2021-10-11 11:03:21', '河南', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '澳门', '地区待确认', 77, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '境外输入', 651, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '宜宾', 13, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '资阳', 4, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '成都', 163, 0, 0, 3], ['2021-10-11 11:03:21', '四川', '绵阳', 23, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '雅安', 8, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '眉山', 8, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '凉山', 13, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '甘孜', 78, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '阿坝', 1, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '泸州', 25, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '巴中', 24, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '达州', 42, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '广安', 30, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '南充', 39, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '乐山', 3, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '内江', 22, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '遂宁', 17, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '广元', 6, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '德阳', 18, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '攀枝花', 16, 0, 0, 0], ['2021-10-11 11:03:21', '四川', '自贡', 9, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '境外输入', 347, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '宁河区', 4, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '北辰区', 7, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '宝坻区', 60, 0, 0, 2], ['2021-10-11 11:03:21', '天津', '河北区', 12, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '津南区', 2, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '南开区', 6, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '河东区', 15, 0, 0, 1], ['2021-10-11 11:03:21', '天津', '滨海新区', 13, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '和平区', 6, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '外地来津', 6, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '武清区', 2, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '东丽区', 4, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '河西区', 4, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '西青区', 4, 0, 0, 0], ['2021-10-11 11:03:21', '天津', '红桥区', 2, 0, 0, 0], ['2021-10-11 11:03:21', '湖北', '境外输入', 73, 0, 0, 0], ['2021-10-11 11:03:21', '湖北', '仙桃', 575, 0, 0, 22], ['2021-10-11 11:03:21', '湖北', '荆州', 1582, 0, 0, 52], ['2021-10-11 11:03:21', '湖北', '武汉', 50380, 0, 0, 3869], ['2021-10-11 11:03:21', '湖北', '黄冈', 2912, 0, 0, 125], ['2021-10-11 11:03:21', '湖北', '鄂州', 1395, 0, 0, 59], ['2021-10-11 11:03:21', '湖北', '宜昌', 931, 0, 0, 37], ['2021-10-11 11:03:21', '湖北', '十堰', 672, 0, 0, 8], ['2021-10-11 11:03:21', '湖北', '孝感', 3518, 0, 0, 129], ['2021-10-11 11:03:21', '湖北', '荆门', 971, 0, 0, 41], ['2021-10-11 11:03:21', '湖北', '黄石', 1015, 0, 0, 39], ['2021-10-11 11:03:21', '湖北', '襄阳', 1175, 0, 0, 40], ['2021-10-11 11:03:21', '湖北', '天门', 496, 0, 0, 15], ['2021-10-11 11:03:21', '湖北', '潜江', 198, 0, 0, 9], ['2021-10-11 11:03:21', '湖北', '恩施州', 252, 0, 0, 7], ['2021-10-11 11:03:21', '湖北', '神农架', 11, 0, 0, 0], ['2021-10-11 11:03:21', '湖北', '咸宁', 836, 0, 0, 15], ['2021-10-11 11:03:21', '湖北', '随州', 1307, 0, 0, 45], ['2021-10-11 11:03:21', '辽宁', '境外输入', 130, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '丹东', 11, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '沈阳', 78, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '大连', 162, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '营口', 11, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '铁岭', 8, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '抚顺', 1, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '朝阳市', 6, 0, 0, 1], ['2021-10-11 11:03:21', '辽宁', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '葫芦岛', 12, 0, 0, 1], ['2021-10-11 11:03:21', '辽宁', '鞍山', 4, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '锦州', 12, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '盘锦', 11, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '阜新', 8, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '辽阳', 3, 0, 0, 0], ['2021-10-11 11:03:21', '辽宁', '本溪', 3, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '境外输入', 63, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '娄底', 76, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '长沙', 244, 0, 0, 2], ['2021-10-11 11:03:21', '湖南', '湘潭', 38, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '湘西自治州', 10, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '益阳', 63, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '株洲', 109, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '张家界', 77, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '怀化', 40, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '永州', 44, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '郴州', 39, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '常德', 82, 0, 0, 0], ['2021-10-11 11:03:21', '湖南', '岳阳', 156, 0, 0, 1], ['2021-10-11 11:03:21', '湖南', '邵阳', 102, 0, 0, 1], ['2021-10-11 11:03:21', '湖南', '衡阳', 48, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '境外输入', 289, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '房山', 25, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '昌平', 32, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '海淀', 83, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '朝阳', 81, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '西城', 59, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '怀柔', 8, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '顺义', 45, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '大兴', 134, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '延庆', 1, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '外地来京', 25, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '门头沟', 5, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '密云', 7, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '东城', 19, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '通州', 20, 0, 0, 9], ['2021-10-11 11:03:21', '北京', '丰台', 273, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '石景山', 15, 0, 0, 0], ['2021-10-11 11:03:21', '北京', '地区待确认', 5, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '境外输入', 148, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '南通', 40, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '扬州', 593, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '南京', 329, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '宿迁', 16, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '淮安', 78, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '盐城', 27, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '苏州', 87, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '无锡', 55, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '徐州', 79, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '连云港', 48, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '镇江', 12, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '常州', 51, 0, 0, 0], ['2021-10-11 11:03:21', '江苏', '泰州', 37, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '境外输入', 428, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '韩城', 1, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '渭南', 17, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '咸阳', 17, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '汉中', 26, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '杨凌', 1, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '西安', 121, 0, 0, 3], ['2021-10-11 11:03:21', '陕西', '榆林', 3, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '商洛', 7, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '延安', 8, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '宝鸡', 13, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '安康', 26, 0, 0, 0], ['2021-10-11 11:03:21', '陕西', '铜川', 8, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '境外输入', 315, 1, 1, 0], ['2021-10-11 11:03:21', '内蒙古', '呼伦贝尔', 38, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '包头', 11, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '呼和浩特', 7, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '乌兰察布', 3, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '锡林郭勒', 9, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '赤峰', 9, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '通辽', 7, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '鄂尔多斯', 11, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '巴彦淖尔', 8, 0, 0, 1], ['2021-10-11 11:03:21', '内蒙古', '兴安盟', 1, 0, 0, 0], ['2021-10-11 11:03:21', '内蒙古', '乌海', 2, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '境外输入', 23, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '通化', 313, 0, 0, 1], ['2021-10-11 11:03:21', '吉林', '长春', 150, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '松原', 6, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '四平', 17, 0, 0, 1], ['2021-10-11 11:03:21', '吉林', '吉林', 48, 0, 0, 1], ['2021-10-11 11:03:21', '吉林', '白城', 1, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '公主岭', 6, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '辽源', 7, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '延边', 5, 0, 0, 0], ['2021-10-11 11:03:21', '吉林', '梅河口市', 1, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '境外输入', 122, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '晋中', 41, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '太原', 21, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '大同', 12, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '运城', 19, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '忻州', 7, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '晋城', 10, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '长治', 8, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '朔州', 8, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '临汾', 2, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '阳泉', 4, 0, 0, 0], ['2021-10-11 11:03:21', '山西', '吕梁', 6, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '伊犁州', 19, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '第八师石河子', 4, 0, 0, 1], ['2021-10-11 11:03:21', '新疆', '乌鲁木齐', 845, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '地区待确认', 1, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '昌吉州', 5, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '兵团第九师', 4, 0, 0, 1], ['2021-10-11 11:03:21', '新疆', '吐鲁番', 3, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '喀什', 80, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '兵团第四师', 10, 0, 0, 1], ['2021-10-11 11:03:21', '新疆', '六师五家渠', 2, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '兵团第十二师', 3, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '巴州', 3, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '第七师', 1, 0, 0, 0], ['2021-10-11 11:03:21', '新疆', '阿克苏', 1, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '境外输入', 37, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '沧州', 49, 0, 0, 3], ['2021-10-11 11:03:21', '河北', '邢台', 94, 0, 0, 1], ['2021-10-11 11:03:21', '河北', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '保定', 49, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '廊坊', 33, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '石家庄', 898, 0, 0, 1], ['2021-10-11 11:03:21', '河北', '张家口', 43, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '唐山', 58, 0, 0, 1], ['2021-10-11 11:03:21', '河北', '邯郸', 32, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '承德', 7, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '衡水', 8, 0, 0, 0], ['2021-10-11 11:03:21', '河北', '秦皇岛', 10, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '海口', 41, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '境外输入', 19, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '三亚', 55, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '儋州', 15, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '东方', 3, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '万宁', 13, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '澄迈县', 9, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '昌江县', 7, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '保亭', 3, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '琼海', 6, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '临高县', 6, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '陵水县', 4, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '乐东', 2, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '文昌', 3, 0, 0, 0], ['2021-10-11 11:03:21', '海南', '定安县', 3, 0, 0, 1], ['2021-10-11 11:03:21', '海南', '琼中县', 1, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '银川', 35, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '境外输入', 4, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '吴忠', 28, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '固原', 5, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '中卫', 3, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '石嘴山', 1, 0, 0, 0], ['2021-10-11 11:03:21', '宁夏', '宁东管委会', 1, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '境外输入', 6, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '南昌', 231, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '新余', 129, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '赣州', 74, 0, 0, 1], ['2021-10-11 11:03:21', '江西', '九江', 116, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '上饶', 123, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '抚州', 72, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '吉安', 22, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '萍乡', 33, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '宜春', 106, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '鹰潭', 18, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '景德镇', 6, 0, 0, 0], ['2021-10-11 11:03:21', '江西', '赣江新区', 1, 0, 0, 0], ['2021-10-11 11:03:21', '青海', '海北州', 3, 0, 0, 0], ['2021-10-11 11:03:21', '青海', '西宁', 15, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '江津区', 6, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '境外输入', 25, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '荣昌区', 9, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '大足区', 14, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '綦江区', 23, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '长寿区', 22, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '沙坪坝区', 9, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '江北区', 28, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '丰都县', 10, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '潼南区', 18, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '铜梁区', 10, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '南岸区', 15, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '九龙坡区', 21, 0, 0, 1], ['2021-10-11 11:03:21', '重庆', '两江新区', 17, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '万州区', 118, 0, 0, 4], ['2021-10-11 11:03:21', '重庆', '巴南区', 6, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '渝中区', 20, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '垫江县', 20, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '云阳县', 25, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '奉节县', 22, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '石柱县', 15, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '渝北区', 17, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '涪陵区', 5, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '彭水县', 2, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '忠县', 21, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '开州区', 21, 0, 0, 1], ['2021-10-11 11:03:21', '重庆', '合川区', 23, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '巫溪县', 14, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '大渡口区', 7, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '巫山县', 10, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '万盛经开区', 1, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '酉阳县', 1, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '璧山区', 9, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '高新区', 4, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '永川区', 5, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '武隆区', 1, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '梁平区', 4, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '城口县', 2, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '黔江区', 2, 0, 0, 0], ['2021-10-11 11:03:21', '重庆', '秀山县', 1, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '境外输入', 1, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '贵阳', 36, 0, 0, 1], ['2021-10-11 11:03:21', '贵州', '六盘水', 10, 0, 0, 1], ['2021-10-11 11:03:21', '贵州', '遵义', 32, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '毕节', 23, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '黔南州', 17, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '安顺', 4, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '黔东南州', 10, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '铜仁', 10, 0, 0, 0], ['2021-10-11 11:03:21', '贵州', '黔西南州', 4, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '境外输入', 7, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '六安', 77, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '合肥', 176, 0, 0, 1], ['2021-10-11 11:03:21', '安徽', '阜阳', 156, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '宣城', 6, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '池州', 17, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '亳州', 108, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '宿州', 41, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '滁州', 13, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '黄山', 9, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '铜陵', 29, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '淮北', 27, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '马鞍山', 38, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '淮南', 27, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '蚌埠', 160, 0, 0, 5], ['2021-10-11 11:03:21', '安徽', '芜湖', 34, 0, 0, 0], ['2021-10-11 11:03:21', '安徽', '安庆', 83, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '境外输入', 107, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '兰州', 37, 0, 0, 2], ['2021-10-11 11:03:21', '甘肃', '定西', 9, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '地区待确认', 0, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '平凉', 9, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '庆阳', 3, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '白银', 4, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '甘南州', 8, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '天水', 12, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '陇南', 4, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '临夏', 3, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '张掖', 2, 0, 0, 0], ['2021-10-11 11:03:21', '甘肃', '金昌', 1, 0, 0, 0], ['2021-10-11 11:03:21', '西藏', '拉萨', 1, 0, 0, 0]]\n"
     ]
    }
   ],
   "source": [
    "# only detaies\n",
    "\n",
    "import json\n",
    "import requests\n",
    "\n",
    "\n",
    "def get_tecent_data():\n",
    "    \"\"\"\n",
    "    :return: dict历史数据 list当日详细数据\n",
    "    \"\"\"\n",
    "    \n",
    "    url = \"http://view.inews.qq.com/g2/getOnsInfo?name=disease_h5\"\n",
    "    headers = {\n",
    "        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'\n",
    "    }\n",
    "    \n",
    "    r = requests.get(url, headers)\n",
    "    res = json.loads(r.text)  # json字符串-->字典\n",
    "    data_all = json.loads(res['data'])\n",
    "     \n",
    "    \n",
    "#     history = {}  # 历史数据\n",
    "    \n",
    "#     for i in data_all['chinaDayList']:\n",
    "#         ds = \"2021.\" + i[\"date\"]\n",
    "#         tup = time.strptime(ds, \"%Y.%m.%d\")\n",
    "#         # 构造数据库字段\n",
    "#         ds = time.strftime(\"%Y-%m-%d\", tup)  # 改为datetime类型和数据库一致\n",
    "#         confirm = i['confirm']\n",
    "#         suspect = i['suspect']\n",
    "#         heal = i['heal']\n",
    "#         dead = i['dead']\n",
    "#         history[ds] = {'confirm': confirm, 'suspect': suspect, 'heal': heal, \"dead\": dead}\n",
    "        \n",
    "#     #for i in data_all['chinaDayAddList']:\n",
    "#     for i in data_all['chinaAdd']:\n",
    "#         ds = \"2021.\" + i['date']\n",
    "#         tup = time.strptime(ds, '%Y.%m.%d')\n",
    "#         # 构造数据库字段\n",
    "#         ds = time.strftime(\"%Y-%m-%d\", tup)  # 改为datetime类型和数据库一致\n",
    "#         confirm = i['confirm']\n",
    "#         suspect = i['suspect']\n",
    "#         heal = i['heal']\n",
    "#         dead = i['dead']\n",
    "#         history[ds].update = {'confirm': confirm, 'suspect': suspect, 'heal': heal, \"dead\": dead}\n",
    "        \n",
    "    # 全国各省市当日详情数据\n",
    "    details = []\n",
    "    \n",
    "    update_time = data_all['lastUpdateTime']\n",
    "    \n",
    "    #data_country = data_all['areaTree']  # list 25个国家\n",
    "    #data_province = data_country[0]['children']  # 中国各省\n",
    "    \n",
    "    data_province = data_all['areaTree'][0]['children']  # 中国各省\n",
    "    \n",
    "    for pro_infos in data_province:\n",
    "        \n",
    "        province = pro_infos['name']  # 省\n",
    "        \n",
    "        for city_infos in pro_infos['children']:\n",
    "            \n",
    "            city = city_infos['name']  # 市\n",
    "            \n",
    "            confirm = city_infos['total']['confirm']\n",
    "            confirm_add = city_infos['today']['confirm']\n",
    "            heal = city_infos['today']['confirm']\n",
    "            dead = city_infos['total']['dead']\n",
    "            details.append([update_time, province, city, confirm, confirm_add, heal, dead])\n",
    "    #return history, details\n",
    "    return details\n",
    "    \n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "6c24c043",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['2021-10-11', 125066, 43, 1, 0, 116827, 44, 5695, 0] <class 'int'>\n",
      "['2021-10-11', 125066, 43, 1, 0, 116827, 44, 5695, 0] [['2021-10-11 14:32:41', '台湾', '地区待确认', 16305, 18, 18, 846], ['2021-10-11 14:32:41', '云南', '境外输入', 1124, 14, 14, 0], ['2021-10-11 14:32:41', '云南', '德宏州', 225, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '昭通市', 25, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '曲靖', 13, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '昆明', 53, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '保山市', 9, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '玉溪', 14, 0, 0, 1], ['2021-10-11 14:32:41', '云南', '红河', 9, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '丽江市', 7, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '大理', 13, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '西双版纳州', 15, 0, 0, 1], ['2021-10-11 14:32:41', '云南', '文山州', 2, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '普洱', 4, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '楚雄州', 4, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '临沧', 1, 0, 0, 0], ['2021-10-11 14:32:41', '云南', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '厦门', 275, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '莆田', 261, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '境外输入', 524, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '泉州', 71, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '漳州', 23, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '三明', 14, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '宁德', 26, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '龙岩', 6, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '南平', 20, 0, 0, 0], ['2021-10-11 14:32:41', '福建', '福州', 72, 0, 0, 1], ['2021-10-11 14:32:41', '福建', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '香港', '地区待确认', 12261, 0, 0, 213], ['2021-10-11 14:32:41', '上海', '境外输入', 2274, 3, 3, 0], ['2021-10-11 14:32:41', '上海', '徐汇', 18, 0, 0, 1], ['2021-10-11 14:32:41', '上海', '浦东', 77, 0, 0, 1], ['2021-10-11 14:32:41', '上海', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '宝山', 26, 0, 0, 1], ['2021-10-11 14:32:41', '上海', '黄浦', 22, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '长宁', 14, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '境外来沪', 1, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '外地来沪', 113, 0, 0, 1], ['2021-10-11 14:32:41', '上海', '嘉定', 9, 0, 0, 2], ['2021-10-11 14:32:41', '上海', '松江', 16, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '静安', 16, 0, 0, 1], ['2021-10-11 14:32:41', '上海', '青浦', 6, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '崇明', 4, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '金山', 4, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '虹口', 7, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '奉贤', 9, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '杨浦', 9, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '普陀', 11, 0, 0, 0], ['2021-10-11 14:32:41', '上海', '闵行', 19, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '哈尔滨', 498, 0, 0, 4], ['2021-10-11 14:32:41', '黑龙江', '境外输入', 402, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '绥化', 537, 0, 0, 4], ['2021-10-11 14:32:41', '黑龙江', '地区待确认', 2, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '齐齐哈尔', 44, 0, 0, 1], ['2021-10-11 14:32:41', '黑龙江', '大庆', 29, 0, 0, 1], ['2021-10-11 14:32:41', '黑龙江', '黑河', 24, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '牡丹江', 36, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '大兴安岭', 3, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '双鸭山', 52, 0, 0, 3], ['2021-10-11 14:32:41', '黑龙江', '鹤岗', 5, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '七台河', 17, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '鸡西', 46, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '伊春', 1, 0, 0, 0], ['2021-10-11 14:32:41', '黑龙江', '佳木斯', 15, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '境外输入', 233, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '金华', 55, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '省十里丰监狱', 36, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '丽水', 17, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '舟山', 10, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '衢州', 14, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '台州', 147, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '绍兴', 42, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '嘉兴', 46, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '湖州', 10, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '温州', 504, 0, 0, 1], ['2021-10-11 14:32:41', '浙江', '宁波', 157, 0, 0, 0], ['2021-10-11 14:32:41', '浙江', '杭州', 181, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '境外输入', 1628, 2, 2, 0], ['2021-10-11 14:32:41', '广东', '中山', 68, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '汕头', 25, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '东莞', 102, 0, 0, 1], ['2021-10-11 14:32:41', '广东', '深圳', 431, 0, 0, 3], ['2021-10-11 14:32:41', '广东', '佛山', 101, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '广州', 523, 0, 0, 1], ['2021-10-11 14:32:41', '广东', '湛江', 23, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '汕尾', 6, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '河源', 5, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '珠海', 98, 0, 0, 1], ['2021-10-11 14:32:41', '广东', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '揭阳', 10, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '江门', 23, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '梅州', 16, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '肇庆', 19, 0, 0, 1], ['2021-10-11 14:32:41', '广东', '阳江', 14, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '惠州', 62, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '茂名', 14, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '韶关', 10, 0, 0, 1], ['2021-10-11 14:32:41', '广东', '清远', 12, 0, 0, 0], ['2021-10-11 14:32:41', '广东', '潮州', 5, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '境外输入', 165, 4, 4, 0], ['2021-10-11 14:32:41', '山东', '淄博', 30, 0, 0, 1], ['2021-10-11 14:32:41', '山东', '青岛', 80, 0, 0, 1], ['2021-10-11 14:32:41', '山东', '济宁', 260, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '济南', 47, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '泰安', 35, 0, 0, 2], ['2021-10-11 14:32:41', '山东', '潍坊', 44, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '枣庄', 24, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '烟台', 58, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '威海', 38, 0, 0, 1], ['2021-10-11 14:32:41', '山东', '菏泽', 18, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '滨州', 15, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '聊城', 38, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '德州', 37, 0, 0, 2], ['2021-10-11 14:32:41', '山东', '临沂', 49, 0, 0, 0], ['2021-10-11 14:32:41', '山东', '日照', 16, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '境外输入', 53, 1, 1, 0], ['2021-10-11 14:32:41', '广西', '桂林', 32, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '北海', 44, 0, 0, 1], ['2021-10-11 14:32:41', '广西', '防城港', 19, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '来宾', 11, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '柳州', 24, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '河池', 28, 0, 0, 1], ['2021-10-11 14:32:41', '广西', '南宁', 56, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '玉林', 11, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '钦州', 8, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '贵港', 8, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '梧州', 5, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '百色', 3, 0, 0, 0], ['2021-10-11 14:32:41', '广西', '贺州', 4, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '境外输入', 104, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '开封', 33, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '郑州', 295, 0, 0, 5], ['2021-10-11 14:32:41', '河南', '商丘', 107, 0, 0, 3], ['2021-10-11 14:32:41', '河南', '驻马店', 143, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '许昌', 40, 0, 0, 1], ['2021-10-11 14:32:41', '河南', '安阳', 54, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '南阳', 156, 0, 0, 3], ['2021-10-11 14:32:41', '河南', '漯河', 36, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '周口', 76, 0, 0, 1], ['2021-10-11 14:32:41', '河南', '鹤壁', 19, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '信阳', 274, 0, 0, 2], ['2021-10-11 14:32:41', '河南', '济源示范区', 5, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '新乡', 57, 0, 0, 3], ['2021-10-11 14:32:41', '河南', '焦作', 32, 0, 0, 1], ['2021-10-11 14:32:41', '河南', '平顶山', 58, 0, 0, 1], ['2021-10-11 14:32:41', '河南', '洛阳', 31, 0, 0, 1], ['2021-10-11 14:32:41', '河南', '濮阳', 17, 0, 0, 0], ['2021-10-11 14:32:41', '河南', '三门峡', 7, 0, 0, 1], ['2021-10-11 14:32:41', '河南', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '澳门', '地区待确认', 77, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '境外输入', 651, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '宜宾', 13, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '资阳', 4, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '成都', 163, 0, 0, 3], ['2021-10-11 14:32:41', '四川', '绵阳', 23, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '雅安', 8, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '眉山', 8, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '凉山', 13, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '甘孜', 78, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '阿坝', 1, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '泸州', 25, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '巴中', 24, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '达州', 42, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '广安', 30, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '南充', 39, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '乐山', 3, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '内江', 22, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '遂宁', 17, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '广元', 6, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '德阳', 18, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '攀枝花', 16, 0, 0, 0], ['2021-10-11 14:32:41', '四川', '自贡', 9, 0, 0, 0], ['2021-10-11 14:32:41', '湖北', '境外输入', 73, 0, 0, 0], ['2021-10-11 14:32:41', '湖北', '仙桃', 575, 0, 0, 22], ['2021-10-11 14:32:41', '湖北', '荆州', 1582, 0, 0, 52], ['2021-10-11 14:32:41', '湖北', '武汉', 50380, 0, 0, 3869], ['2021-10-11 14:32:41', '湖北', '黄冈', 2912, 0, 0, 125], ['2021-10-11 14:32:41', '湖北', '鄂州', 1395, 0, 0, 59], ['2021-10-11 14:32:41', '湖北', '宜昌', 931, 0, 0, 37], ['2021-10-11 14:32:41', '湖北', '十堰', 672, 0, 0, 8], ['2021-10-11 14:32:41', '湖北', '孝感', 3518, 0, 0, 129], ['2021-10-11 14:32:41', '湖北', '荆门', 971, 0, 0, 41], ['2021-10-11 14:32:41', '湖北', '黄石', 1015, 0, 0, 39], ['2021-10-11 14:32:41', '湖北', '襄阳', 1175, 0, 0, 40], ['2021-10-11 14:32:41', '湖北', '天门', 496, 0, 0, 15], ['2021-10-11 14:32:41', '湖北', '潜江', 198, 0, 0, 9], ['2021-10-11 14:32:41', '湖北', '恩施州', 252, 0, 0, 7], ['2021-10-11 14:32:41', '湖北', '神农架', 11, 0, 0, 0], ['2021-10-11 14:32:41', '湖北', '咸宁', 836, 0, 0, 15], ['2021-10-11 14:32:41', '湖北', '随州', 1307, 0, 0, 45], ['2021-10-11 14:32:41', '天津', '境外输入', 347, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '宁河区', 4, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '北辰区', 7, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '宝坻区', 60, 0, 0, 2], ['2021-10-11 14:32:41', '天津', '河北区', 12, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '津南区', 2, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '南开区', 6, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '河东区', 15, 0, 0, 1], ['2021-10-11 14:32:41', '天津', '滨海新区', 13, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '和平区', 6, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '外地来津', 6, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '武清区', 2, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '东丽区', 4, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '河西区', 4, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '西青区', 4, 0, 0, 0], ['2021-10-11 14:32:41', '天津', '红桥区', 2, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '境外输入', 130, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '丹东', 11, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '沈阳', 78, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '大连', 162, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '营口', 11, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '铁岭', 8, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '抚顺', 1, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '朝阳市', 6, 0, 0, 1], ['2021-10-11 14:32:41', '辽宁', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '葫芦岛', 12, 0, 0, 1], ['2021-10-11 14:32:41', '辽宁', '鞍山', 4, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '锦州', 12, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '盘锦', 11, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '阜新', 8, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '辽阳', 3, 0, 0, 0], ['2021-10-11 14:32:41', '辽宁', '本溪', 3, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '境外输入', 63, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '娄底', 76, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '长沙', 244, 0, 0, 2], ['2021-10-11 14:32:41', '湖南', '湘潭', 38, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '湘西自治州', 10, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '益阳', 63, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '株洲', 109, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '张家界', 77, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '怀化', 40, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '永州', 44, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '郴州', 39, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '常德', 82, 0, 0, 0], ['2021-10-11 14:32:41', '湖南', '岳阳', 156, 0, 0, 1], ['2021-10-11 14:32:41', '湖南', '邵阳', 102, 0, 0, 1], ['2021-10-11 14:32:41', '湖南', '衡阳', 48, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '境外输入', 289, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '房山', 25, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '昌平', 32, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '海淀', 83, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '朝阳', 81, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '西城', 59, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '怀柔', 8, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '顺义', 45, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '大兴', 134, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '延庆', 1, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '外地来京', 25, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '门头沟', 5, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '密云', 7, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '东城', 19, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '通州', 20, 0, 0, 9], ['2021-10-11 14:32:41', '北京', '丰台', 273, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '石景山', 15, 0, 0, 0], ['2021-10-11 14:32:41', '北京', '地区待确认', 5, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '境外输入', 148, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '南通', 40, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '扬州', 593, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '南京', 329, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '宿迁', 16, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '淮安', 78, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '盐城', 27, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '苏州', 87, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '无锡', 55, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '徐州', 79, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '连云港', 48, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '镇江', 12, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '常州', 51, 0, 0, 0], ['2021-10-11 14:32:41', '江苏', '泰州', 37, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '境外输入', 428, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '韩城', 1, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '渭南', 17, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '咸阳', 17, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '汉中', 26, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '杨凌', 1, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '西安', 121, 0, 0, 3], ['2021-10-11 14:32:41', '陕西', '榆林', 3, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '商洛', 7, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '延安', 8, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '宝鸡', 13, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '安康', 26, 0, 0, 0], ['2021-10-11 14:32:41', '陕西', '铜川', 8, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '境外输入', 315, 1, 1, 0], ['2021-10-11 14:32:41', '内蒙古', '呼伦贝尔', 38, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '包头', 11, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '呼和浩特', 7, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '乌兰察布', 3, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '锡林郭勒', 9, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '赤峰', 9, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '通辽', 7, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '鄂尔多斯', 11, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '巴彦淖尔', 8, 0, 0, 1], ['2021-10-11 14:32:41', '内蒙古', '兴安盟', 1, 0, 0, 0], ['2021-10-11 14:32:41', '内蒙古', '乌海', 2, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '境外输入', 23, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '通化', 313, 0, 0, 1], ['2021-10-11 14:32:41', '吉林', '长春', 150, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '松原', 6, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '四平', 17, 0, 0, 1], ['2021-10-11 14:32:41', '吉林', '吉林', 48, 0, 0, 1], ['2021-10-11 14:32:41', '吉林', '白城', 1, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '公主岭', 6, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '辽源', 7, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '延边', 5, 0, 0, 0], ['2021-10-11 14:32:41', '吉林', '梅河口市', 1, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '境外输入', 122, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '晋中', 41, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '太原', 21, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '大同', 12, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '运城', 19, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '忻州', 7, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '晋城', 10, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '长治', 8, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '朔州', 8, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '临汾', 2, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '阳泉', 4, 0, 0, 0], ['2021-10-11 14:32:41', '山西', '吕梁', 6, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '伊犁州', 19, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '第八师石河子', 4, 0, 0, 1], ['2021-10-11 14:32:41', '新疆', '乌鲁木齐', 845, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '地区待确认', 1, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '昌吉州', 5, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '兵团第九师', 4, 0, 0, 1], ['2021-10-11 14:32:41', '新疆', '吐鲁番', 3, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '喀什', 80, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '兵团第四师', 10, 0, 0, 1], ['2021-10-11 14:32:41', '新疆', '六师五家渠', 2, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '兵团第十二师', 3, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '巴州', 3, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '第七师', 1, 0, 0, 0], ['2021-10-11 14:32:41', '新疆', '阿克苏', 1, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '境外输入', 37, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '沧州', 49, 0, 0, 3], ['2021-10-11 14:32:41', '河北', '邢台', 94, 0, 0, 1], ['2021-10-11 14:32:41', '河北', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '保定', 49, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '廊坊', 33, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '石家庄', 898, 0, 0, 1], ['2021-10-11 14:32:41', '河北', '张家口', 43, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '唐山', 58, 0, 0, 1], ['2021-10-11 14:32:41', '河北', '邯郸', 32, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '承德', 7, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '衡水', 8, 0, 0, 0], ['2021-10-11 14:32:41', '河北', '秦皇岛', 10, 0, 0, 1], ['2021-10-11 14:32:41', '重庆', '江津区', 6, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '境外输入', 25, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '荣昌区', 9, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '大足区', 14, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '綦江区', 23, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '长寿区', 22, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '沙坪坝区', 9, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '江北区', 28, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '丰都县', 10, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '潼南区', 18, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '铜梁区', 10, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '南岸区', 15, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '九龙坡区', 21, 0, 0, 1], ['2021-10-11 14:32:41', '重庆', '两江新区', 17, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '万州区', 118, 0, 0, 4], ['2021-10-11 14:32:41', '重庆', '巴南区', 6, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '渝中区', 20, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '垫江县', 20, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '云阳县', 25, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '奉节县', 22, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '石柱县', 15, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '渝北区', 17, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '涪陵区', 5, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '彭水县', 2, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '忠县', 21, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '开州区', 21, 0, 0, 1], ['2021-10-11 14:32:41', '重庆', '合川区', 23, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '巫溪县', 14, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '大渡口区', 7, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '巫山县', 10, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '万盛经开区', 1, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '酉阳县', 1, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '璧山区', 9, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '高新区', 4, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '永川区', 5, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '武隆区', 1, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '梁平区', 4, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '城口县', 2, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '黔江区', 2, 0, 0, 0], ['2021-10-11 14:32:41', '重庆', '秀山县', 1, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '银川', 35, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '境外输入', 4, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '吴忠', 28, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '固原', 5, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '中卫', 3, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '石嘴山', 1, 0, 0, 0], ['2021-10-11 14:32:41', '宁夏', '宁东管委会', 1, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '境外输入', 6, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '南昌', 231, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '新余', 129, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '赣州', 74, 0, 0, 1], ['2021-10-11 14:32:41', '江西', '九江', 116, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '上饶', 123, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '抚州', 72, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '吉安', 22, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '萍乡', 33, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '宜春', 106, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '鹰潭', 18, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '景德镇', 6, 0, 0, 0], ['2021-10-11 14:32:41', '江西', '赣江新区', 1, 0, 0, 0], ['2021-10-11 14:32:41', '青海', '海北州', 3, 0, 0, 0], ['2021-10-11 14:32:41', '青海', '西宁', 15, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '境外输入', 107, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '兰州', 37, 0, 0, 2], ['2021-10-11 14:32:41', '甘肃', '定西', 9, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '地区待确认', 0, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '平凉', 9, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '庆阳', 3, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '白银', 4, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '甘南州', 8, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '天水', 12, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '陇南', 4, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '临夏', 3, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '张掖', 2, 0, 0, 0], ['2021-10-11 14:32:41', '甘肃', '金昌', 1, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '海口', 41, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '境外输入', 19, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '三亚', 55, 0, 0, 1], ['2021-10-11 14:32:41', '海南', '儋州', 15, 0, 0, 1], ['2021-10-11 14:32:41', '海南', '东方', 3, 0, 0, 1], ['2021-10-11 14:32:41', '海南', '万宁', 13, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '澄迈县', 9, 0, 0, 1], ['2021-10-11 14:32:41', '海南', '昌江县', 7, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '保亭', 3, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '琼海', 6, 0, 0, 1], ['2021-10-11 14:32:41', '海南', '临高县', 6, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '陵水县', 4, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '乐东', 2, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '文昌', 3, 0, 0, 0], ['2021-10-11 14:32:41', '海南', '定安县', 3, 0, 0, 1], ['2021-10-11 14:32:41', '海南', '琼中县', 1, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '境外输入', 1, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '贵阳', 36, 0, 0, 1], ['2021-10-11 14:32:41', '贵州', '六盘水', 10, 0, 0, 1], ['2021-10-11 14:32:41', '贵州', '遵义', 32, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '毕节', 23, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '黔南州', 17, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '安顺', 4, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '黔东南州', 10, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '铜仁', 10, 0, 0, 0], ['2021-10-11 14:32:41', '贵州', '黔西南州', 4, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '境外输入', 7, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '六安', 77, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '合肥', 176, 0, 0, 1], ['2021-10-11 14:32:41', '安徽', '阜阳', 156, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '宣城', 6, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '池州', 17, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '亳州', 108, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '宿州', 41, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '滁州', 13, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '黄山', 9, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '铜陵', 29, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '淮北', 27, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '马鞍山', 38, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '淮南', 27, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '蚌埠', 160, 0, 0, 5], ['2021-10-11 14:32:41', '安徽', '芜湖', 34, 0, 0, 0], ['2021-10-11 14:32:41', '安徽', '安庆', 83, 0, 0, 0], ['2021-10-11 14:32:41', '西藏', '拉萨', 1, 0, 0, 0]]\n"
     ]
    }
   ],
   "source": [
    "import json\n",
    "import requests\n",
    "\n",
    "\n",
    "def get_tecent_data():\n",
    "    \"\"\"\n",
    "    :return: list全国汇总数据/日期为主键每日更新 list当日详细数据\n",
    "    \"\"\"\n",
    "    \n",
    "    url = \"http://view.inews.qq.com/g2/getOnsInfo?name=disease_h5\"\n",
    "    headers = {\n",
    "        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'\n",
    "    }\n",
    "    \n",
    "    r = requests.get(url, headers)\n",
    "    res = json.loads(r.text)  # json字符串-->字典\n",
    "    data_all = json.loads(res['data'])\n",
    "    \n",
    "    update_time = data_all['lastUpdateTime']\n",
    "    chinaTotal = data_all['chinaTotal']\n",
    "    chinaAdd = data_all['chinaAdd']\n",
    "    \n",
    "    # 全国汇总历史数据\n",
    "    history = {}  \n",
    "    \n",
    "    ds = update_time.split()[0]  # 构造数据库字段\n",
    "    confirm = chinaTotal['confirm']\n",
    "    suspect = chinaTotal['suspect']\n",
    "    heal = chinaTotal['heal']\n",
    "    dead = chinaTotal['dead']\n",
    "    confirm_add = chinaAdd['confirm']\n",
    "    suspect_add = chinaAdd['suspect']\n",
    "    heal_add = chinaAdd['heal']\n",
    "    dead_add = chinaAdd['dead']\n",
    "    history = [ds, confirm, confirm_add, suspect, suspect_add, heal, heal_add, dead, dead_add]\n",
    "\n",
    "           \n",
    "    \n",
    "    # 全国各省市当日详情数据\n",
    "    details = []\n",
    "    \n",
    "    \n",
    "    data_province = data_all['areaTree'][0]['children']  # 中国各省\n",
    "    \n",
    "    for pro_infos in data_province:\n",
    "        \n",
    "        province = pro_infos['name']  # 省\n",
    "        \n",
    "        for city_infos in pro_infos['children']:\n",
    "            \n",
    "            city = city_infos['name']  # 市\n",
    "            \n",
    "            confirm = city_infos['total']['confirm']\n",
    "            confirm_add = city_infos['today']['confirm']\n",
    "            heal = city_infos['today']['confirm']\n",
    "            dead = city_infos['total']['dead']\n",
    "            details.append([update_time, province, city, confirm, confirm_add, heal, dead])\n",
    "            \n",
    "    return history, details\n",
    "    \n",
    "    \n",
    "h, d = get_tecent_data() \n",
    "print(h, d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e77b5e6d",
   "metadata": {},
   "outputs": [],
   "source": [
    "def update_baidu_hot():\n",
    "    \"\"\"\n",
    "    插入百度热搜数据\n",
    "    :return:\n",
    "    \"\"\"\n",
    "\n",
    "    cursor = None\n",
    "    conn = None\n",
    "\n",
    "    hot_list = get_baidu_hot()\n",
    "\n",
    "    print(f\"{time.asctime()}开始更新百度热搜数据 !\")\n",
    "    try:\n",
    "        conn, cursor = get_conn()\n",
    "        sql = \"insert into bdhot(hotrank, hotscore, title, content) values(%s, %s, %s, %s)\"\n",
    "        for hot in hot_list:\n",
    "\n",
    "            hotrank = int(hot[0])\n",
    "            hotscore = int(hot[1])\n",
    "            title = hot[3]\n",
    "            content = hot[4]\n",
    "\n",
    "            tup = (hotrank, hotscore, title, content)\n",
    "            print(tup)\n",
    "            cursor.execute(sql, tup)\n",
    "        conn.commit()\n",
    "        print(f\"{time.asctime()}百度热搜数据更新完成 !\")\n",
    "    except:\n",
    "        traceback.print_exc()\n",
    "    finally:\n",
    "        close_conn(conn, cursor)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aa300ec0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "36127a90",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd36b7f1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "96205160",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2fb4357d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
